import 'package:flutter_base/common/utils/utils.dart';
import 'package:flutter_base/common/values/colors.dart';
import 'package:flutter_base/common/widgets/widgets.dart';
import 'package:flutter/material.dart';

Widget ztbRefresher(
    {required bool loading,
    required List? list,
    required Widget widget,
    final VoidCallback? refresh}) {
  return loading
      ? cardListSkeleton()
      : isEmpty(list)
          ? Center(
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  loadAssetImage('no_data'),
                  Container(
                    height: zhiSetHeight(10),
                  ),
                  GestureDetector(
                    onTap: refresh,
                    child: Text(
                      '暂无记录',
                      style: TextStyle(
                          color: Colors.grey[600],
                          fontSize: 18,
                          fontWeight: FontWeight.normal),
                    ),
                  ),
                  Container(
                    height: zhiSetHeight(50),
                  )
                ],
              ),
            )
          : widget;
}
